home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / util / bsindex1 / part03 < prev   
Encoding:
Internet Message Format  |  1990-02-02  |  38.8 KB

  1. Path: xanth!cs.odu.edu!Amiga-Request
  2. From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i043: BBSindex 1.0 - file database utility for BBS-PC!, Part03/03
  5. Message-ID: <11250@xanth.cs.odu.edu>
  6. Date: 2 Feb 90 19:57:16 GMT
  7. Sender: tadguy@cs.odu.edu
  8. Reply-To: Eddy Carroll <ECARROLL%vax1.tcd.ie@CUNYVM.CUNY.EDU>
  9. Lines: 851
  10. Approved: tadguy@cs.odu.edu (Tad Guy)
  11. X-Mail-Submissions-To: Amiga@cs.odu.edu
  12.  
  13. Submitted-by: Eddy Carroll <ECARROLL%vax1.tcd.ie@CUNYVM.CUNY.EDU>
  14. Posting-number: Volume 90, Issue 043
  15. Archive-name: util/bbsindex-1.0/part03
  16.  
  17. #!/bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 3 (of 3)."
  24. # Contents:  bbsindex.doc
  25. # Wrapped by tadguy@xanth on Fri Feb  2 14:54:43 1990
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'bbsindex.doc' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'bbsindex.doc'\"
  29. else
  30. echo shar: Extracting \"'bbsindex.doc'\" \(36686 characters\)
  31. sed "s/^X//" >'bbsindex.doc' <<'END_OF_FILE'
  32. X
  33. X                BBSINDEX -- generates BBS-PC! file listings
  34. X
  35. X                 (C) Copyright Eddy Carroll, December 1989
  36. X
  37. X
  38. XINTRODUCTION
  39. X
  40. X    BBSindex is a utility for use with the BBS-PC! bulletin board package.
  41. X    It reads in the UDHEAD.DAT file database and allows you to list its
  42. X    contents in a wide variety of ways. It has its own script language
  43. X    which allows great control over the output produced.
  44. X
  45. X    BBSindex can perform the following operations on the file database:
  46. X
  47. X      - Sort the files into order by Name, Size, Date or any other field
  48. X      - Select files matching specified criteria
  49. X      - Print file lists, using a user specified format string
  50. X      - Determine which files are currently present in the download dirs
  51. X      - List files that are in the download dirs but not the database
  52. X
  53. X    The script language allows you to combine these to perform tasks such
  54. X    as the following:
  55. X
  56. X      - Produce file lists similar to those produced with the BBS-PC!
  57. X        catalogue command, but sorted into any order. For example, BBS-PC!
  58. X        won't let you list all the files in a given directory sorted into
  59. X        alphabetical order. BBSindex will. With BBSindex, such lists can
  60. X        be generated automatically and regularly (e.g. daily), and made
  61. X        available to the BBS users through a menu item. The same file can
  62. X        be locally uploaded into the file section for users to download.
  63. X
  64. X      - Produce a list of files on and off line, just like BBS-PC!'s ChkFile
  65. X        utility. In addition, BBSindex can spot files which are online but
  66. X        which have a filesize different to that in the file catalogue. Such
  67. X        files are most likely corrupt.
  68. X
  69. X      - Build AmigaDOS batch files to perform maintenance tasks, such as
  70. X        moving all the files in a particular section from whatever disk
  71. X        directories they are currently located in into a new directory, or
  72. X        moving all the files which are in the BBS-PC! download directories
  73. X        but are NOT in the file catalogue to somewhere else.
  74. X
  75. X    Without further ado, let's move on to the program itself.
  76. X
  77. X
  78. XUSAGE
  79. X
  80. X    The command template for bbsindex looks like this:
  81. X
  82. X        bbsindex {options} scriptfile ...
  83. X
  84. X    You must always specify at least one script file to be executed. If
  85. X    BBSindex can't find the file you asked for, it will look for a
  86. X    similarly named one with a .SCR suffix. If you specify several files,
  87. X    BBSindex will execute them in sequence as if they were a single
  88. X    continuous file. Any settings, open files etc. are maintained across
  89. X    multiple script files. This can be both a help and a hinderance; if
  90. X    you are careful not to make scripts to reliant on default settings,
  91. X    you shouldn't have any problems.
  92. X
  93. X    BBSindex allows you to change some of its default settings via command
  94. X    line options. These can all be changed via script commands as well,
  95. X    but it is sometimes convenient to be able to alter them independently of
  96. X    the script. The available options are listed below. Note that for those
  97. X    options that take a parameter, there must be a space between the option
  98. X    letter and the parameter.
  99. X
  100. X    -c filename
  101. X        This option allows you to specify the name of the configuration
  102. X        file BBSindex should read to locate BBS-PC!'s download directories.
  103. X        By default, it looks for the file CFGINFO.DAT in the current
  104. X        directory. If you are running BBSindex from a directory other than
  105. X        BBS-PC's home directory, you may need to use this option.
  106. X
  107. X    -d filename
  108. X        This option lets you specify the name of the file in which BBS-PC!
  109. X        stores all the information about its file database. By default,
  110. X        BBSindex will look for the file UDHEAD.DAT in the current directory.
  111. X
  112. X    -f "string"
  113. X        This option lets you change the format string used when outputting
  114. X        file listings. See the discussion of the FORMAT command for a full
  115. X        explanation of what to use here.
  116. X
  117. X    -h
  118. X        This prints out a brief help screen listing the command line
  119. X        options.
  120. X
  121. X    -n
  122. X        This option stops BBSindex from putting up AmigaDOS requesters
  123. X        (such as "Please insert volume FOO: in any drive"). It can be
  124. X        useful if some of the BBS download directories are not currently
  125. X        mounted, and BBSindex tries to access them.
  126. X
  127. X    -s
  128. X        This option causes any OPEN or APPEND commands to be ignored,
  129. X        resulting in all output going to the screen. This is useful for
  130. X        seeing the output from a script that normally goes to a disk file.
  131. X
  132. X    -t
  133. X        This option enables trace mode, which is useful for debugging large
  134. X        scripts. Before each command in the script is executed, it is
  135. X        printed to the screen. See the discussion of the TRACE command for
  136. X        more information on the output produced, and its usefulness.
  137. X
  138. X    An alternative method of running BBSindex is provided, to make it
  139. X    possible to setup a menu option within BBS-PC! which will invoke
  140. X    BBSindex automatically. This can be done using menu function 111
  141. X    (Run External Program). However, BBS-PC! doesn't allow parameters to be
  142. X    passed to programs started in this manner. To get around this, BBSindex
  143. X    can be renamed to BBscript. When it is run as BBscript, it ignores any
  144. X    command line parameters and instead looks for a script file called
  145. X    BBSindex.scr in the current directory. This is particularly useful if
  146. X    you are running the system remotely, and don't have easy access to the
  147. X    local keyboard.
  148. X
  149. X    There are a few things to look out for. You should run BBSindex in the
  150. X    same directory as BBS-PC!'s CFGINFO.DAT and UDHEAD.DAT files (unless you
  151. X    override these defaults with -c and -d, or via the appropriate script
  152. X    commands). In addition, if you want BBSindex to know which files are
  153. X    online and valid, you need to give the CHECKFILES command in the script.
  154. X    This deliberate step is needed because checking all the files can take
  155. X    some time on a large system, and is not always required. You should also
  156. X    ensure that your CLI stack size is set to around 10000 or so. If
  157. X    BBSindex runs out of stack, it will tell you so; restart it with a
  158. X    larger stack.
  159. X
  160. X    BBSindex needs a lot of memory to run -- around 300K altogether when
  161. X    processing a 200K database. This is because the entire database file is
  162. X    kept in memory while processing. Of course, people with a 200K file
  163. X    database are likely to have extra memory as well, so this shouldn't be
  164. X    a huge problem, though it may prevent you from running BBSindex from
  165. X    within BBS-PC!. In any case, BBSindex doesn't crash when it runs out
  166. X    of memory, it prints an error message, frees up all its resources and
  167. X    exits cleanly. It does likewise if you press CTRL-C, which can be used
  168. X    to abort at almost any time. (Sorting can't be interrupted, because the
  169. X    overhead of checking for CTRL-C would make it significantly slower.
  170. X    Sorts are pretty quick anyway, since they are done completely in memory).
  171. X
  172. X    By now, you're probably wondering what actually goes into the script
  173. X    file that BBSindex interprets. The next section describes this in
  174. X    detail. You can also look at the example script files which accompany
  175. X    BBSindex for a few ideas. Try running them with the -s option to make
  176. X    them send output to the screen.
  177. X
  178. X
  179. XSCRIPT FILES
  180. X
  181. X    A script file is simply a standard text file which contains a list
  182. X    of BBSindex commands to be executed. It is similar to a standard
  183. X    AmigaDOS batch file, though quite a bit more flexible in its layout.
  184. X
  185. X    You normally put one command on each line (blank lines are fine of
  186. X    course), but you can have multiple commands on a single line if you
  187. X    seperate them with a semicolon (`;'). Commands are case insensitive
  188. X    (everything is converted to uppercase internally). You can build up
  189. X    extra long command lines by ending each physical line with `\'. The
  190. X    following newline will then be ignored, and the command continued
  191. X    on the next line. Anything after a `#' to the end of a line is
  192. X    treated as a comment.
  193. X
  194. X    Many commands take parameters. Multiple parameters are seperated
  195. X    by commas or spaces. If you want to include spaces or lowercase
  196. X    characters in a parameter (usually the case), you need to surround it
  197. X    with quotes. You can use either single or double quotes; if you use
  198. X    single quotes, the string inside can contain double quotes and vice
  199. X    versa.
  200. X
  201. X    BBSindex allows you to define constants, which can then be used later
  202. X    on as part of a command. It can be useful to assign items subject to
  203. X    change (such as output filenames) to constants at the start of the
  204. X    script file, and to use these constants throughout the rest of the file.
  205. X    Changing a filename then becomes a simple matter of altering the
  206. X    constant definition, rather than having to hunt through the script file.
  207. X
  208. X    You define a constant by saying
  209. X
  210. X        name = value
  211. X
  212. X    where name is any identifier up to 20 characters, and value is a
  213. X    single string. If value is surrounded by quotes, they are stripped off,
  214. X    but the case of the text inside is retained. To use the constant, you
  215. X    just say $(name) anywhere in a command, even within quotes. Any `$'
  216. X    character which isn't immediately followed by an open parenthesis is
  217. X    left unchanged.
  218. X
  219. X    For example, you might say at the start of a script
  220. X
  221. X        Filename = "Sys:BBS/Amiga.Files"
  222. X
  223. X    and then later on, you could use it to open a file:
  224. X
  225. X        OPEN $(Filename)
  226. X
  227. X    As with everything else, constant names are case insensitive.
  228. X
  229. X
  230. XSCRIPT COMMANDS
  231. X
  232. X    This section contains a list of the commands recognised by BBSindex. If
  233. X    you make an error in a script, you'll get an error message listing the
  234. X    name of the script file, the line the error occurred on, and a brief
  235. X    explanatory message.
  236. X
  237. X    To start with, here's a brief synopsis of all the commands. Below this,
  238. X    each command is described in detail.
  239. X
  240. X    Command Name        Description
  241. X    ~~~~~~~~~~~~        ~~~~~~~~~~~
  242. X    APPEND "name"       Append future output to the end of file "name"
  243. X    CHECKFILES          Scan BBS-PC!'s file directories
  244. X    CLOSE               Close current output file, reverting to screen
  245. X    CONFIG "name"       Specify full pathname to access the CFGINFO.DAT file
  246. X    DATABASE "name"     Specify full pathname to access the UDHEAD.DAT file
  247. X    ECHO "string"       Output "string" to the current output file
  248. X    EXEC "command"      Execute an AmigaDOS command
  249. X    FOREIGN             List all the files not in BBS-PC's file catalogue
  250. X    FORMAT "string"     Specify the format to print file listings in
  251. X    IGNORE file ...     Specify files to ignore when doing CHECKFILES
  252. X    LIST                List all the files matching the SELECT criteria
  253. X    MACRO name/ENDM     Define a new macro called name
  254. X    MSG "string"        Display "string" on the screen
  255. X    NOREQUEST           Stop AmigaDOS putting up error requesters
  256. X    OPEN "name"         Direct future output to file "name"
  257. X    RESET               Reset the file counters used by SCAN and LIST
  258. X    SCAN                Update counters as LIST, but don't print any output
  259. X    SELECT criteria     Specify criteria to use when listing files
  260. X    SORT index ...      Sort database under the specified fields
  261. X    TRACE [ON | OFF]    Turn on or off trace mode
  262. X
  263. X
  264. XAPPEND Filename
  265. X
  266. X    Opens an existing file as the current output file. Any output from
  267. X    BBSindex will be appended to the end of this file, until it is closed.
  268. X    When no file is open, output goes to the screen. If a file is already
  269. X    open when this command is given, then it will be closed before the
  270. X    new file is opened.
  271. X
  272. X
  273. XCHECKFILES [dir1, dir2, ...]
  274. X
  275. X    Causes the BBS-PC! file directories on the local disk to be scanned,
  276. X    so that it can determine which files are online and which are not. It
  277. X    also compares the size of each file in the catalogue with its size on
  278. X    disk, and if the two are different, sets the invalid flag for that file.
  279. X    This is a reasonable indication that the file may be corrupt.
  280. X
  281. X    CHECKFILES need only be done if you want to use the %f, %i, %p or %v
  282. X    options of FORMAT, or you want to use the FOREIGN command. A single
  283. X    CHECKFILES checks all the files, so it need only be done once. Future
  284. X    occurances of CHECKFILES are ignored.
  285. X
  286. X    By default, BBSindex looks in the CFGINFO.DAT file to find out the
  287. X    location of the BBS-PC! file directories. CFGINFO.DAT should be in the
  288. X    current directory, unless the -c option has been given to specify a
  289. X    different location for it.
  290. X
  291. X    If you give a list of directories to CHECKFILES, then these directories
  292. X    are scanned instead of those in CFGINFO.DAT, and the latter doesn't
  293. X    need to be accessed.
  294. X
  295. X
  296. XCLOSE
  297. X
  298. X    Closes the current file (if any) for output. Any future output gets
  299. X    sent to the screen. It is not necessary to specifically close files
  300. X    when you are finished with them (unless you really do want the output
  301. X    to start being displayed on the screen) since BBSindex will close
  302. X    files automatically when it exits.
  303. X
  304. X
  305. XCONFIG "filename"
  306. X
  307. X    Tells BBSindex where to find the BBS-PC! configuration file, which
  308. X    contains the directory paths for the upload/download file directories.
  309. X    This file is only accessed if you give a CHECKFILES command and don't
  310. X    specify any directories; if you don't intend doing a CHECKFILES, you
  311. X    don't need to worry about BBSindex being able to find the configuration
  312. X    file. By default, BBSindex looks for the file CFGINFO.DAT in the
  313. X    current directory.
  314. X
  315. X    Be careful to specify the full filename of the configuration file,
  316. X    not just the directory name.
  317. X
  318. X
  319. XDATABASE "filename"
  320. X
  321. X    Tells BBSindex where to find the BBS-PC! file database. The commands
  322. X    CHECKFILES, SORT, LIST and SCAN will all cause the file database to be
  323. X    read in. The DATABASE command can be given at any stage before this.
  324. X    Afterwards, it has no effect. If you don't give a DATABASE command,
  325. X    then the file UDHEAD.DAT in the current directory is used.
  326. X
  327. X
  328. XECHO "string" [NOLINE]
  329. X
  330. X    Outputs "string" to the current file, or if no output file is open, to
  331. X    the screen. "string" can contain any of the escape characters (such
  332. X    as `\n') listed under FORMAT. It can also contain any of the following
  333. X    special symbols:
  334. X
  335. X        %b      The number of bytes used by files printed by the last LIST
  336. X        %k      The number of Kilobytes used by files printed by last LIST
  337. X        %m      The number of Megabytes used by files printed by last LIST
  338. X        %n      The number of files printed by the last LIST command
  339. X        %d      Today's day (Monday for example)
  340. X        %t      Today's time
  341. X        %ux     Creates underline, see FORMAT for more details
  342. X        %w      Today's date (01-Jan-90 for example)
  343. X        %{...}  Formats substring, see FORMAT for more details
  344. X
  345. X    %B, %K, %M and %N are also available; these are similar to %b, %k,
  346. X    %m and %n, but they are the sums for all the files printed since the
  347. X    last RESET command, rather than the last LIST command. This allows you
  348. X    to keep a running count of the total number of files printed in the
  349. X    system.
  350. X
  351. X    By default, a newline is automatically output after the string. This
  352. X    can be suppressed by including the NOLINE parameter.
  353. X
  354. X
  355. XEXEC "command"
  356. X
  357. X    Executes the specified AmigaDOS command. The output from the command is
  358. X    directed into the current output file. If you don't want this to happen,
  359. X    you can specify redirection to NIL: as part of the command string. For
  360. X    example
  361. X
  362. X        EXEC "makedir >nil: ram:t"
  363. X
  364. X    will try and make a directory in RAM:, and if it fails, you won't see
  365. X    anything. The EXEC command can be particularly useful if you've just
  366. X    used the FORMAT command in conjunction with LIST to generate an AmigaDOS
  367. X    script file -- you can then do
  368. X
  369. X        EXEC "Execute Scriptfile"
  370. X
  371. X    and the script file will be executed on the spot. If you do this,
  372. X    remember to close the script file you've just generated before you try
  373. X    to execute it.
  374. X
  375. X
  376. XFOREIGN
  377. X
  378. X    Outputs a list of all the files which are present in BBS-PC!'s download
  379. X    directories, but are not present in the file catalogue. The output is as
  380. X    specified using FORMAT, but only some of the options are applicable. In
  381. X    particular, the following are valid:
  382. X
  383. X            %d  Disk filename
  384. X            %c  Descriptive text saying what directory the file is in
  385. X            %f  Full disk filename
  386. X            %n  The disk filename again
  387. X            %p  Disk pathname
  388. X            %x  File size in bytes
  389. X            %k  File size in K
  390. X            %w  Date file was last modified
  391. X
  392. X    These have been chosen so that the default output format will list the
  393. X    files in a sensible fashion.
  394. X
  395. X    This command can be useful if you want to track down all files which
  396. X    are not directly related to the bulletin board. For example, the
  397. X    following script generates an AmigaDOS script to move all the non-BBS
  398. X    files into a common directory called Random on DH1:
  399. X
  400. X        #
  401. X        # Script to move all files not related to the BBS-PC! file
  402. X        # catalogue out of the download directories.
  403. X        #
  404. X        CHECKFILES      # Check all files
  405. X        ECHO ";\n; AmigaDOS script to cleanup BBS file directories\n;"
  406. X        FORMAT "copy %f to dh1:random\ndelete %f\n"
  407. X        OPEN ram:execute.script
  408. X        FOREIGN
  409. X        CLOSE
  410. X
  411. X    When you run this, the output is a script in RAM: which you can then
  412. X    execute using the AmigaDOS Execute command. Alternatively, you could
  413. X    add the command EXEC "Execute RAM:execute.script" to the end of the
  414. X    above script, and then the script itself would move the files.
  415. X
  416. X
  417. XFORMAT "string" [NOLINE]
  418. X
  419. X    Determines the format of each line printed by the LIST command. The
  420. X    format string is very similar to that used by C's printf() function. It
  421. X    contains normal characters, plus any of the following special symbols:
  422. X
  423. X        %a      Number of times file has been accessed
  424. X        %b{}    File type {Binary,Text}
  425. X        %c      Comment associated with file
  426. X        %d      Filename the file is stored under on disk
  427. X        %f      Full pathname of the disk copy of the file
  428. X        %i{}    File status {Online,Offline}
  429. X        %k      File size in K
  430. X        %l{}    File origin {Local,Remote}
  431. X        %n      Filename as it appears in the file database
  432. X        %o      Uploader's name (owner)
  433. X        %p      Path of the directory containing the file on disk
  434. X        %r      Directory number
  435. X        %s      Section name
  436. X        %ux     Produce underline using x as underline char
  437. X        %v{}    File contents {Valid,Invalid}
  438. X        %w      Upload date (when)
  439. X        %x      File size
  440. X        %y      Number of the disk directory the file is stored in
  441. X        %{...}  Format substring
  442. X
  443. X    A number may optionally be placed between `%' and the appropriate
  444. X    character. This will cause the output value of the symbol to be padded
  445. X    or truncated to that width. By default, the output is aligned to the
  446. X    left but if the number is prefixed with `-', output is aligned to the
  447. X    right.
  448. X
  449. X    Symbols followed by {} are boolean values, which can be either TRUE or
  450. X    FALSE. When such a symbol appears in the format string, it should be
  451. X    immediately followed by two substrings enclosed in { and } and separated
  452. X    by a comma. If its value is TRUE, then the first substring is used; else,
  453. X    the second substring is used. For example, if you want to make a list of
  454. X    files, and say whether each one is valid or invalid, you might use:
  455. X
  456. X        "%20n%v{,(Invalid)}"
  457. X
  458. X    which would print each filename, and if it was invalid, would follow it
  459. X    with the string "(Invalid)", starting in Column 20. If the file was
  460. X    valid, only the filename would be printed.
  461. X
  462. X    A special option is `%{', which allows you to format a substring within
  463. X    the main string. This can be of value if you want to have several items,
  464. X    one after the other with no gaps between each, but with the total width
  465. X    of all the items not exceeding a set width. What occurs inside the
  466. X    braces after `%' can be any valid format string, which could itself
  467. X    contain `%{}'s (though it's hard to think of a situation where you would
  468. X    need to do this). So, "%40{%s,%r,%o}" would print the section, directory
  469. X    number and owner name one after the other, with the total being padded
  470. X    or truncated to 40 characters.
  471. X
  472. X    The other unusual option is `%u', which reproduces the character
  473. X    following it a number of times equal to the length of the last string
  474. X    output using FORMAT. If `%{...}' has just been used, then the length of
  475. X    the substring is used instead. This is handy if you want to underline
  476. X    something but are not sure how long it is (or you just want to save some
  477. X    typing). For example, to underline a filename, you could use:
  478. X
  479. X        FORMAT "%{%n}\n%u-"
  480. X
  481. X    This outputs the filename as a substring (thus remembering the length),
  482. X    and a newline, and then underlines the filename using ------. When using
  483. X    `%u', the "length" number that can appear between the `%' and the format
  484. X    character has a slightly different meaning. `%6u' outputs an extra 6
  485. X    underline characters, and `%-6u' outputs 6 fewer characters.
  486. X
  487. X    The `%i' and `%v' options only make sense if the CHECKFILES command has
  488. X    been given earlier. They indicate whether or not the file is online and
  489. X    whether it is valid. A file is online if it can be found in any of
  490. X    BBS-PC!'s file directories. It is valid if its filesize on disk matches
  491. X    its filesize in the file catalogue. If it doesn't, then there is a good
  492. X    chance it has been corrupted.
  493. X
  494. X    The `%y' option gives the number of the disk directory in which the
  495. X    file is stored. This is the position of the disk directory as it
  496. X    appears in BBS-PC!'s CFGINFO.DAT file. In particular, the "new uploads"
  497. X    directory is numbered 0. (Note that this is different to the directory 0
  498. X    in which all uploads are located within BBS-PC!).
  499. X
  500. X    The following escape sequences can also appear in the format string:
  501. X
  502. X        \n      End of line
  503. X        \e      Escape
  504. X        \E      CSI (0x9b)
  505. X        \t      Tab
  506. X        \nnn    Octal number with the appropriate value
  507. X
  508. X    Any other characters after a `\' are treated as normal. This can be used
  509. X    to escape certain characters that have special meaning, such as `\'
  510. X    itself and `%'. `\{' and `\}' do not work within `{...}' (for boolean
  511. X    values and substrings) unfortunately. If you are giving the format
  512. X    string from the command line and you are using a DOS shell other than
  513. X    the CLI, you might need to type `\\' in order to get the shell to pass a
  514. X    single `\' to BBSindex. Note that while `\E' can be useful for
  515. X    generating ANSI colour codes (as in `\E33m' to change the colour to
  516. X    colour 3 for example), BBS-PC! does not recognise `\E', even though
  517. X    AmigaDOS does. Hence, for public BBS files, you are better off using
  518. X    `\e[33m' which gives the same effect. For more details on ANSI escape
  519. X    sequences, see the BBS-PC! or AmigaDOS manuals.
  520. X
  521. X    By default, a newline is automatically added to the format string. This
  522. X    can be overridden by including the NOLINE parameter after the string.
  523. X
  524. X    The default output format string is
  525. X
  526. X        FORMAT "%15n %w %-6x-%b{B,T}  %c"
  527. X
  528. X    This produces a file listing which is identical to the listing BBS-PC!
  529. X    gives when you ask for a file catalogue.
  530. X
  531. X
  532. XIGNORE Filename Filename ...
  533. X
  534. X    Specifies a list of files to ignore when CHECKFILES is executed. If you
  535. X    have some files in the file catalogue which are updated by external
  536. X    programs, their filesizes are likely to differ from the filesizes
  537. X    recorded in the BBS-PC! file catalogue. By listing such files here, you
  538. X    can tell CHECKFILES that it is okay for the filesizes to be different
  539. X    and they will then be marked as valid (and hence won't appear in any
  540. X    operations you do on invalid files).
  541. X
  542. X    You can use multiple IGNORE commands if you have a lot of files falling
  543. X    into this category; however, only IGNORE commands which occur before
  544. X    CHECKFILES have any effect.
  545. X
  546. X
  547. XLIST
  548. X
  549. X    Scans through the the file catalogue (as sorted using SORT) and outputs
  550. X    the list of files which match the criteria specified with SELECT,
  551. X    according to the format string defined using FORMAT. Output is sent to
  552. X    the current file (opened with OPEN) or if none exists, to the screen.
  553. X
  554. X    In addition, some internal counters are updated. These counters record
  555. X    the number of files listed and the total number of bytes occupied by
  556. X    those files. A seperate set of counters record the total number of files
  557. X    listed since the start of the script (or the last RESET command). This
  558. X    is useful for building cumulative totals. See the ECHO command for more
  559. X    details.
  560. X
  561. X
  562. XMACRO name
  563. X  command 1
  564. X  command 2
  565. X    ...
  566. XENDM
  567. X
  568. X    Defines a macro command. When this command is used later on, it gets
  569. X    replaced by the list of commands between the MACRO and ENDM markers.
  570. X    The macro text can contain the special symbols $1 to $9 which will
  571. X    expand to the parameters given to the command. For example, a macro to
  572. X    sort and list the files in a specified directory in a given section
  573. X    might look like this:
  574. X
  575. X        MACRO Listdir  # Section, Directory, Descriptive Text
  576. X          MSG "$2, " noline
  577. X          ECHO "%{$2. $3}\n%u-" # Display header, and underline it
  578. X          SELECT Section = $1 AND Directory = $2
  579. X          LIST
  580. X        ENDM
  581. X
  582. X    To use this, you would then give a command like:
  583. X
  584. X        Listdir 1, 4, "General Files"
  585. X
  586. X    to list the files in Directory 4 of Section 1. Note that the comma is
  587. X    optional (it gets turned into a space internally anyway) but can make
  588. X    things more readable. Also note that any text surrounded by quotes has
  589. X    the quotes removed (but the text case retained) when it is substituted.
  590. X    This is to allow $ substitution to occur within strings in the macro
  591. X    without getting lots of extra quotes everywhere. If you need to get a $
  592. X    itself inside the macro, you can use `$$'. In fact, `$' followed by any
  593. X    non-numeric character will simply return that character.
  594. X
  595. X    Macros are a very powerful feature; used sensibly, they can reduce the
  596. X    size of your script files by a significant amount, allowing you to
  597. X    express a complicated sequence of commands in only a single line. If you
  598. X    have many command sequences which are very similar, it is well worth
  599. X    taking the time to learn to use macros effectively.
  600. X
  601. X
  602. XMSG "string" [NOLINE]
  603. X
  604. X    Outputs "string" just like the ECHO command, except that the string
  605. X    always goes to the screen, even when an output file is open. This
  606. X    provides a useful way to print informative messages saying what is
  607. X    happening, while processing a big script.
  608. X
  609. X
  610. XNOREQUEST
  611. X
  612. X    Stops AmigaDOS from putting up requesters when it can't find a disk
  613. X    volume, or when a disk error occurs. This can be useful if you are
  614. X    running BBSindex in a batch environment, where you most likely won't be
  615. X    around to click Retry or Cancel in the requester. It is also useful if
  616. X    you are running BBSindex remotely (from within BBS-PC! as a menu option).
  617. X
  618. X
  619. XOPEN Filename
  620. X
  621. X    Opens a new file for output. Any output from BBSindex will be directed
  622. X    to this file until it is closed. When no file is open, output goes to
  623. X    the screen. If a file is already open when this command is given, then
  624. X    it will be closed before the new file is opened.
  625. X
  626. X
  627. XRESET
  628. X
  629. X    Resets the counters used by the %B, %K, %M and %N options of the ECHO
  630. X    command. See the descriptions of SCAN and ECHO for more details.
  631. X
  632. X
  633. XSCAN
  634. X
  635. X    Scans the file database, counting files that match the SELECT criteria
  636. X    just like LIST. Unlike LIST, it doesn't produce any output.  It does
  637. X    however update the counters which keep track of the number of files
  638. X    printed. This is very useful if you want to produce a file listing which
  639. X    displays the number of files in the system at the start of the file,
  640. X    followed by the files themselves. You can do that as follows:
  641. X
  642. X        SCAN
  643. X        ECHO "Amiga BBS File Catalogue, a total of %n files are online\n\n"
  644. X        LIST
  645. X
  646. X    SCAN counts the files so that %n will be the correct number in the ECHO
  647. X    command, and then LIST actually lists them. Of course, if you wanted to
  648. X    print the number of files at the bottom of the list, the LIST command
  649. X    by itself would be adequate, and you would not need to use SCAN.
  650. X
  651. X
  652. XSELECT expression
  653. X
  654. X    Selects which files should be printed on the screen when the LIST
  655. X    command is given. The expression you give can include any of the
  656. X    keywords recognised by the SORT command, plus the boolean operators
  657. X    AND, OR and NOT, and the special keyword ALL (which is always true). In
  658. X    addition, the keywords Text, Remote, Offline and Invalid are recognised
  659. X    as opposites to Binary, Local, Online and Valid.
  660. X
  661. X    The following arithmetic operators are supported:
  662. X
  663. X        =   <>    >    <    >=   <=
  664. X
  665. X    These can be combined together with strings and numbers and grouped
  666. X    with parenthesis to produce a full expression. During LIST, any files
  667. X    which match the expression are listed. For example, to select all the
  668. X    binary files in Section 3, and Directories 4-10, you could use
  669. X
  670. X        SELECT Section = 3 AND Directory >= 4 AND Directory <= 10 AND Binary
  671. X
  672. X    Note that the eight boolean fields (Binary, Text, Online, Offline,
  673. X    Local, Remote, Valid and Invalid) don't need to be tested against
  674. X    anything, since they already evaulate to a boolean result. For example,
  675. X    Local will evaluate to TRUE if the file being checked was uploaded
  676. X    locally.
  677. X
  678. X    For date comparisons, recent dates are treated as being "larger"
  679. X    than older dates. For example, to list all files uploaded during
  680. X    December of 1989, you could say
  681. X
  682. X        SELECT Date >= "01-Dec-89" AND Date <= "31-Dec-89"
  683. X
  684. X    String comparisons are case insensitive, and standard wildcards are
  685. X    supported. A `?' in a string will match any single character, and a `*'
  686. X    will match any number of characters (including none). For example
  687. X
  688. X        SELECT Name = "*.ZOO" AND Section = 3
  689. X
  690. X    selects all the zoo files in section 3. The pattern "?????" would match
  691. X    all names five characters long. If you wanted to select all the files
  692. X    which were archived using a common file archiver, you might use:
  693. X
  694. X        SELECT Name = "*.ZOO" OR Name = "*.ARC" OR Name = "*.LZH"
  695. X
  696. X    If you want to use <, >, <= and >= with wildcard matching, you need to
  697. X    be careful. Bear in mind that < and > exclude exact matches, whereas
  698. X    <= and >= include exact matches. As an example, let's see use a file
  699. X    called "FOO". The comparison "FOO" < "F*" is not particularly well
  700. X    defined, but will probably be FALSE. On the other hand, "FOO" <= "F*"
  701. X    will always evaluate to true, since the `=' portion is true.
  702. X
  703. X    Let's finish off with some more examples of selections. To select all
  704. X    the text files in section 3, you could use:
  705. X
  706. X        SELECT Section = F and Text
  707. X
  708. X    Now, let's select all the binary files in section 3, and also all the
  709. X    text files in section 3 that end with .ZOO or .ARC (such a requirement
  710. X    might come about because some versions of BBS-PC! have a bug which
  711. X    makes ZMODEM uploads look like Text files):
  712. X
  713. X        SELECT Section = 3 and (Binary or Name = "*.ZOO" or Name = "*.ARC")
  714. X
  715. X    As a final note, be aware that the more complicated the expression, the
  716. X    longer it will take to do a LIST (or SCAN). You can help speed things
  717. X    up by arranging that the condition most likely to be FALSE is at the
  718. X    front of the expression. For example, use
  719. X
  720. X        SELECT Size > 102400 and Name <> *.ZOO
  721. X
  722. X    when selecting all non-ZOO files in the system greater than 100K, rather
  723. X    than the other way around.
  724. X
  725. X
  726. XSORT index [, index, index ...]
  727. X
  728. X    Sorts the file list into an order determined by the list of indices
  729. X    given. When output is being generated, it is sorted according to the
  730. X    indices specified here. The following indices are valid:
  731. X
  732. X        Access      Number of times a file has been accessed (number)
  733. X        Binary      Whether the file is binary or text (boolean)
  734. X        Comment     File comment (string)
  735. X        Date        Upload date (date)
  736. X        Directory   Directory number (number)
  737. X        DiskDirNum  Number of the file directory on disk (number)
  738. X        DiskName    Name of the file on disk (string)
  739. X        KSize       File size in K (number)
  740. X        Local       Whether the file was uploaded locally (boolean)
  741. X        Name        File catalogue name (String)
  742. X        Online      Whether the file is online (boolean)
  743. X        Owner       Uploader's name (String)
  744. X        Pathname    Pathname of disk file (String)
  745. X        Section     Section number (number)
  746. X        Size        File size in bytes (number)
  747. X        Valid       Whether the filesize is valid (boolean)
  748. X
  749. X    Each index can optionally by followed by a `+' or `-', to indicate the
  750. X    direction of sorting. The default (+) is to sort in ascending order.
  751. X    Descending order is selected using `-'. As many indices as are listed
  752. X    are considered significant while sorting.
  753. X
  754. X    The default sorting order is Name which sorts files by name. An
  755. X    alternative index might be Section, Directory, Name which would sort
  756. X    the files into seperate sections, then into seperate directories within
  757. X    each section, and finally into alphabetical order within each directory.
  758. X
  759. X    You can sort files into chronological order by using Date as the sort
  760. X    key, or into reverse chronological order (i.e. newest files first) by
  761. X    using Date- as the key.
  762. X
  763. X    Note that the CHECKFILES command sorts the database into alphabetical
  764. X    order by disk name before it starts scanning the disk. If you have given
  765. X    a SORT command before this, then CHECKFILES will sort the files a second
  766. X    time back into the order you specified. You can avoid the time overhead
  767. X    this involves (which is not actually that much) by not using SORT until
  768. X    after CHECKFILES.
  769. X
  770. X
  771. XTRACE [ON | OFF]
  772. X
  773. X    Turns on or off trace mode. When tracing is turned on, all the commands
  774. X    thereafter will be output to the screen before they are executed. This
  775. X    can be useful for tracking down a problem with a script. In particular,
  776. X    the commands which make up a macro will be printed individually each
  777. X    time the macro is executed, with $1 to $9 replaced by the actual
  778. X    parameters. Constants will also be replaced by their current value.
  779. X    Tracing can be turned on globally by specifying the -t option on the
  780. X    command line; TRACE ON and TRACE OFF are most useful when you have a
  781. X    large script file and you don't want to have to trace through all of it.
  782. X
  783. X
  784. XHISTORY
  785. X
  786. X    V0.99   Initial beta release. Several bugs, and a few inconsistencies.
  787. X
  788. X            - Vigilant beta testers proved that nothing works first time :-)
  789. X            - Kudos to Lattice's catch.o for making life a bit more bearable
  790. X              (and also to CodeProbe of course).
  791. X
  792. X    V1.0    First official release.
  793. X
  794. X            - Improved memory allocator to handle small requests by
  795. X              allocating a large chunk and working from that. This should
  796. X              help decrease memory fragmentation.
  797. X            - Added support for constants
  798. X            - Added IGNORE keyword to allow "dynamic" files to avoid being
  799. X              marked as invalid.
  800. X            - Reworked the documentation a bit, so that it wasn't quite as
  801. X              disorganised.
  802. X            - Toyed with the idea of allowing scripts to be specified on
  803. X              the command line (like sed) but decided wasn't worth the
  804. X              effort for now.
  805. X
  806. X
  807. XDISTRIBUTION
  808. X
  809. X    BBSindex may be freely distributed for non-commercial purposes, as long
  810. X    as no profit is made from doing so. It may be distributed with
  811. X    commercial software only with the express written agreement of the
  812. X    author. Specific permission is granted to Fred Fish to include BBSindex
  813. X    in his fine public domain library.
  814. X
  815. X
  816. XAUTHOR
  817. X
  818. X    Please direct any praise, criticism, general suggestions or
  819. X    large sums of money to:
  820. X
  821. X    Eddy Carroll
  822. X    ecarroll@vax1.tcd.ie (Trinity College, Dublin, Ireland)
  823. X
  824. X    Also, please feel welcome to pay a visit to Infomatique BBS, of
  825. X    which I am a co-sysop:
  826. X
  827. X        Phone:   +353-1-302970  (Ireland)
  828. X        Speeds:  V21/22bis/23
  829. X        Times:   24 hours/day
  830. X
  831. X    110 Megs of online storage, large Amiga and IBM file database.
  832. X    Membership is free. If you call, mention where you got the number.
  833. END_OF_FILE
  834. if test 36686 -ne `wc -c <'bbsindex.doc'`; then
  835.     echo shar: \"'bbsindex.doc'\" unpacked with wrong size!
  836. fi
  837. # end of 'bbsindex.doc'
  838. fi
  839. echo shar: End of archive 3 \(of 3\).
  840. cp /dev/null ark3isdone
  841. MISSING=""
  842. for I in 1 2 3 ; do
  843.     if test ! -f ark${I}isdone ; then
  844.     MISSING="${MISSING} ${I}"
  845.     fi
  846. done
  847. if test "${MISSING}" = "" ; then
  848.     echo You have unpacked all 3 archives.
  849.     rm -f ark[1-9]isdone
  850. else
  851.     echo You still need to unpack the following archives:
  852.     echo "        " ${MISSING}
  853. fi
  854. ##  End of shell archive.
  855. exit 0
  856. -- 
  857. Submissions to comp.sources.amiga and comp.binaries.amiga should be sent to:
  858.     amiga@cs.odu.edu    
  859. or    amiga@xanth.cs.odu.edu    ( obsolescent mailers may need this address )
  860. or    ...!uunet!xanth!amiga    ( very obsolescent mailers need this address )
  861.  
  862. Comments, questions, and suggestions s should be addressed to ``amiga-request''
  863. (only use ``amiga'' for submissions) at the above addresses.
  864.